<!DOCTYPE html>
<html>
<head>
    <title>Get Max</title>
</head>
<body>
<script type=”text/javascript”>
    alert("11");
    console.log("1");
    function fillRnd(arrLen){
        for(var i = 0, arr=[]; i < arrLen; i++){
            arr[i] = Math.ceil(Math.random()*10);
        }
        return arr;
    }
    function getMax1(arr){
        var arrLen = arr.length;
        for(var i = 0, ret = arr[0]; i < arrLen; i++){
            ret = Math.max(ret, arr[i]);
        }
        return ret;
    }
    function getMax2(arr){
        return Math.max.apply(null, arr);
    }

    var myArr = fillRnd(20*10000);
    var t1 = new Date();
    var max1 = getMax1(myArr);
    var t2 = new Date();
    var max2 = getMax2(myArr);
    var t3 = new Date();
    if(max1 !== max2)
        alert("error");
    alert([t3-t2, t2-t1]);

</script>
</body>
</html>